home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / vla / stars / stargen.bas next >
BASIC Source File  |  1993-03-15  |  1KB  |  58 lines

  1. '
  2. 'Written by: Draeden /VLA
  3. '      Date: 03/15/93
  4. '
  5. '     Notes: Used for generating 'random' data for Stars.asm
  6. '
  7.  
  8.  
  9.     NumStars = 400
  10.     dim     RndArray(NumStars)
  11.     randomize (timer)
  12.  
  13.     'fill the array with numbers from -Numstars/2 to -10
  14.     'and from 10 to Numstars/2
  15.  
  16.     i=10
  17.     for r = 0 to NumStars/2
  18.         RndArray(r)=i
  19.         i=i+1
  20.     next
  21.     i=-10
  22.     for r = NumStars/2 to NumStars
  23.         RndArray(r)=i
  24.         i=i-1
  25.     next
  26.  
  27.     'randomly shuffle them..
  28.  
  29.     print "Total numbers: ";NumStars
  30.     print "Shuffling - Please wait... "
  31.  
  32.     for q = 1 to numstars/5
  33.         for r = 0 to NumStars
  34.             swnum1 = int(rnd*NumStars+.5)
  35.             swap RndArray(swnum1),RndArray(r)
  36.         next
  37.     next
  38.  
  39.     'write the numbers neatly to a file
  40.  
  41.     open "starrnd.dw" for output as 1
  42.     cc= 0
  43.     print#1, "StarRnd dw ";:print#1, using"####";RndArray(0)
  44.     for r = 1 to NumStars
  45.  
  46.         IF cc=0 THEN
  47.             print#1, "dw ";:print#1, using"####" ;RndArray(r);
  48.         ELSE 
  49.             print#1, ",";:print#1, using"####"; RndArray(r);
  50.         END IF
  51.  
  52.         cc=cc+1:if cc= 10 then cc=0:print#1," "
  53.     next
  54.     close #1
  55.  
  56.  
  57.  
  58.